package com.zy;

import com.zy.config.WebInit;
import com.zy.service.SomeService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.testng.annotations.Test;

/**
 * @author LittleDesire
 * @description
 * @date 2022-04-06 周三 17:57
 * @since 17
 */
@SpringJUnitConfig
public class App {
    @Test
    public void m1() {
        ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
        SomeService bean = ac.getBean(SomeService.class);
        bean.doSome("asdf");
        bean.say();
    }

    @Test
    public void m2() {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
        ctx.register(WebInit.class);
        ctx.refresh();
        SomeService bean = ctx.getBean(SomeService.class);
        String s = bean.doSome("fang");
        System.out.println("返回 "+s);

        bean.say();
    }
}
